/**
 * Created by Administrator on 2017/10/25.
 */
import   React from  'react'
import {connect} from 'react-redux'
import {addGUN,removeGUN,addGUNAsync} from './index.redux'
import   {Button,WhiteSpace } from 'antd-mobile'
@connect(
  //你要state的什么属性放到props里面
  state=>({num:state}),
  //你要什么方法，放到props里面，自动dispatch
  {addGUN,removeGUN,addGUNAsync}
)//装饰器优化connect


class App extends  React.Component{
    render(){
        return (
            <div>
                <h1>现在有{this.props.num}把机枪</h1>    
                <WhiteSpace size="xl" />
                <Button type="primary" onClick={this.props.addGUN}>增加一把机枪</Button>
                <WhiteSpace size="xl" />
                <Button type="primary" onClick={this.props.removeGUN}>回收一把机枪</Button>
               <WhiteSpace size="xl" />
                <Button type="primary" onClick={this.props.addGUNAsync}>拖两天增加一把机枪</Button>
            </div>
        )
    }
}



export  default  App